﻿using DataAcquisition.Main;
using DataAcquisition.Main.Base;
using DataAcquisition.Library;

namespace DataAcquisition.Main
{
    public partial class IndexForm2 : DABaseForm
    {
        #region 加载菜单
        private void SetupMenu()
        {
            var menuItems = Util.MenuItems;

            foreach (var rootItem in menuItems)
            {
                var rootMenu = new AntdUI.MenuItem
                {
                    Text = rootItem.Text,
                    IconSvg = rootItem.IconSvg,
                    Tag = rootItem.Tag,
                };
                DAMenu.Items.Add(rootMenu);
            }
        }
        #endregion

        #region 点击菜单
        private void DAMenu_SelectChanged(object sender, AntdUI.MenuSelectEventArgs e)
        {
            if (e.Value.Tag != null)
            {
                string tag = (string)e.Value.Tag;
                if (tag == "DeviceManage")
                {
                    DeviceManageForm frm = new DeviceManageForm();
                    frm.ShowDialog();
                }
            }
        }
        #endregion

        #region 系统事件
        public IndexForm2()
        {
            InitializeComponent();
            FullScreen = true;
        }

        private void IndexForm2_Load(object sender, EventArgs e)
        {
            SetupMenu();
        }



        #endregion
    }
}
